﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.CCUiLMInterpolateLocationOrientationDlg
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using EngineeringInternalExtension;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Resources;
using System.Windows.Forms;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Ui;


namespace DnProcessSimulateCommands;

public class CCUiLMInterpolateLocationOrientationDlg : TxForm
{
  private CCCoLMInterpolateLocationOrientationCmd m_command;
  private CCApLMInterpolateLocationOrientationApp m_application;
  private Label label1;
  private Button m_cancel;
  private Button m_ok;
  private TxObjGridCtrl m_LocationsList;
  private TxFrameEditBoxCtrl m_referenceLoc;
  private ITxObject m_firstLocation;
  private ITxObject m_secondLocation;
  private TxFrame m_transientRefLoc;
  private TxFrame m_secondTransientRefLoc;
  private bool m_refLocOK;
  private bool m_secRefLocOK;
  private TxFrameEditBoxCtrl m_secondReferenceLoc;
  private Label label2;
  private Label label3;
  private RadioButton m_noneFixedAxisButton;
  private RadioButton m_zFixedAxisButton;
  private RadioButton m_yFixedAxisButton;
  private RadioButton m_xFixedAxisButton;
  private Label label4;
  private Label label5;
  private Container components;

  public CCUiLMInterpolateLocationOrientationDlg(CCCoLMInterpolateLocationOrientationCmd command)
  {
    this.InitializeComponent();
    this.m_command = command;
    this.m_command.DialogIsOpen(true);
    this.m_application = new CCApLMInterpolateLocationOrientationApp();
    this.m_refLocOK = false;
    this.m_secRefLocOK = false;
    this.RegisterToUnloadDocumentEvent();
  }

  protected virtual void Dispose(bool disposing)
  {
    if (disposing && this.components != null)
      this.components.Dispose();
    base.Dispose(disposing);
  }

  private void InitializeComponent()
  {
    ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof (CCUiLMInterpolateLocationOrientationDlg));
    this.label1 = new Label();
    this.m_cancel = new Button();
    this.m_ok = new Button();
    this.m_LocationsList = new TxObjGridCtrl();
    this.m_referenceLoc = new TxFrameEditBoxCtrl();
    this.m_secondReferenceLoc = new TxFrameEditBoxCtrl();
    this.label2 = new Label();
    this.label3 = new Label();
    this.m_noneFixedAxisButton = new RadioButton();
    this.m_zFixedAxisButton = new RadioButton();
    this.m_yFixedAxisButton = new RadioButton();
    this.m_xFixedAxisButton = new RadioButton();
    this.label4 = new Label();
    this.label5 = new Label();
    ((Control) this).SuspendLayout();
    componentResourceManager.ApplyResources((object) this.label1, "label1");
    this.label1.Name = "label1";
    this.m_cancel.DialogResult = DialogResult.Cancel;
    componentResourceManager.ApplyResources((object) this.m_cancel, "m_cancel");
    this.m_cancel.Name = "m_cancel";
    this.m_cancel.Click += new EventHandler(this.m_cancel_Click);
    componentResourceManager.ApplyResources((object) this.m_ok, "m_ok");
    this.m_ok.Name = "m_ok";
    this.m_ok.Click += new EventHandler(this.m_ok_Click);
    ((UserControl) this.m_LocationsList).BorderStyle = BorderStyle.FixedSingle;
    this.m_LocationsList.ChangeGeneralSelection = false;
    this.m_LocationsList.CurrentRow = -1;
    this.m_LocationsList.EnableMultipleSelection = true;
    this.m_LocationsList.EnableRecurringObjects = false;
    this.m_LocationsList.ListenToPick = false;
    componentResourceManager.ApplyResources((object) this.m_LocationsList, "m_LocationsList");
    ((Control) this.m_LocationsList).Name = "m_LocationsList";
    this.m_LocationsList.PickLevel = (TxPickLevel) 2;
    this.m_LocationsList.ReadOnly = false;
    this.m_LocationsList.ValidatorType = (TxValidatorType) 16 /*0x10*/;
    this.m_LocationsList.Picked += new TxObjGridCtrl_PickedEventHandler(this.m_LocationsList_Picked);
    this.m_referenceLoc.EnableRelativeToWorkingFrameCoordinates = true;
    this.m_referenceLoc.ListenToPick = false;
    componentResourceManager.ApplyResources((object) this.m_referenceLoc, "m_referenceLoc");
    ((Control) this.m_referenceLoc).Name = "m_referenceLoc";
    this.m_referenceLoc.PickLevel = (TxPickLevel) 6;
    this.m_referenceLoc.ValidatorType = (TxValidatorType) 1;
    this.m_referenceLoc.VisualizePickedFrameInGraphicViewer = false;
    this.m_referenceLoc.InvalidFrameSet += new TxFrameEditBoxCtrl_InvalidFrameSetEventHandler(this.m_referenceLoc_InvalidFrameSet);
    this.m_referenceLoc.ValidFrameSet += new TxFrameEditBoxCtrl_ValidFrameSetEventHandler(this.m_referenceLoc_ValidFrameSet);
    this.m_referenceLoc.Picked += new TxFrameEditBoxCtrl_PickedEventHandler(this.m_referenceLoc_Picked);
    this.m_secondReferenceLoc.EnableRelativeToWorkingFrameCoordinates = true;
    this.m_secondReferenceLoc.ListenToPick = false;
    componentResourceManager.ApplyResources((object) this.m_secondReferenceLoc, "m_secondReferenceLoc");
    ((Control) this.m_secondReferenceLoc).Name = "m_secondReferenceLoc";
    this.m_secondReferenceLoc.PickLevel = (TxPickLevel) 6;
    this.m_secondReferenceLoc.ValidatorType = (TxValidatorType) 1;
    this.m_secondReferenceLoc.VisualizePickedFrameInGraphicViewer = false;
    this.m_secondReferenceLoc.InvalidFrameSet += new TxFrameEditBoxCtrl_InvalidFrameSetEventHandler(this.m_secondReferenceLoc_InvalidFrameSet);
    this.m_secondReferenceLoc.ValidFrameSet += new TxFrameEditBoxCtrl_ValidFrameSetEventHandler(this.m_secondReferenceLoc_ValidFrameSet);
    this.m_secondReferenceLoc.Picked += new TxFrameEditBoxCtrl_PickedEventHandler(this.m_secondReferenceLoc_Picked);
    componentResourceManager.ApplyResources((object) this.label2, "label2");
    this.label2.Name = "label2";
    componentResourceManager.ApplyResources((object) this.label3, "label3");
    this.label3.Name = "label3";
    componentResourceManager.ApplyResources((object) this.m_noneFixedAxisButton, "m_noneFixedAxisButton");
    this.m_noneFixedAxisButton.Name = "m_noneFixedAxisButton";
    this.m_noneFixedAxisButton.TabStop = true;
    this.m_noneFixedAxisButton.UseVisualStyleBackColor = true;
    componentResourceManager.ApplyResources((object) this.m_zFixedAxisButton, "m_zFixedAxisButton");
    this.m_zFixedAxisButton.Name = "m_zFixedAxisButton";
    this.m_zFixedAxisButton.TabStop = true;
    this.m_zFixedAxisButton.UseVisualStyleBackColor = true;
    componentResourceManager.ApplyResources((object) this.m_yFixedAxisButton, "m_yFixedAxisButton");
    this.m_yFixedAxisButton.Name = "m_yFixedAxisButton";
    this.m_yFixedAxisButton.TabStop = true;
    this.m_yFixedAxisButton.UseVisualStyleBackColor = true;
    componentResourceManager.ApplyResources((object) this.m_xFixedAxisButton, "m_xFixedAxisButton");
    this.m_xFixedAxisButton.Name = "m_xFixedAxisButton";
    this.m_xFixedAxisButton.TabStop = true;
    this.m_xFixedAxisButton.UseVisualStyleBackColor = true;
    componentResourceManager.ApplyResources((object) this.label4, "label4");
    this.label4.Name = "label4";
    componentResourceManager.ApplyResources((object) this.label5, "label5");
    this.label5.Name = "label5";
    componentResourceManager.ApplyResources((object) this, "$this");
    ((ContainerControl) this).AutoScaleMode = AutoScaleMode.Font;
    ((Control) this).Controls.Add((Control) this.label5);
    ((Control) this).Controls.Add((Control) this.label4);
    ((Control) this).Controls.Add((Control) this.m_xFixedAxisButton);
    ((Control) this).Controls.Add((Control) this.m_yFixedAxisButton);
    ((Control) this).Controls.Add((Control) this.m_zFixedAxisButton);
    ((Control) this).Controls.Add((Control) this.m_noneFixedAxisButton);
    ((Control) this).Controls.Add((Control) this.label3);
    ((Control) this).Controls.Add((Control) this.label2);
    ((Control) this).Controls.Add((Control) this.m_secondReferenceLoc);
    ((Control) this).Controls.Add((Control) this.m_referenceLoc);
    ((Control) this).Controls.Add((Control) this.m_LocationsList);
    ((Control) this).Controls.Add((Control) this.m_cancel);
    ((Control) this).Controls.Add((Control) this.m_ok);
    ((Control) this).Controls.Add((Control) this.label1);
    ((Form) this).FormBorderStyle = FormBorderStyle.FixedDialog;
    ((Form) this).MaximizeBox = false;
    ((Form) this).MinimizeBox = false;
    ((Control) this).Name = nameof (CCUiLMInterpolateLocationOrientationDlg);
    ((Form) this).Closed += new EventHandler(this.CCUiLMInterpolateLocationsDlg_Closed);
    ((Form) this).Load += new EventHandler(this.CCUiLMInterpolateLocationOrientationDlg_Load);
    ((Control) this).Enter += new EventHandler(this.m_ok_Click);
    ((Control) this).ResumeLayout(false);
    ((Control) this).PerformLayout();
  }

  internal void InitializeDialog()
  {
    // ISSUE: unable to decompile the method.
  }

  private void CCUiLMInterpolateLocationsDlg_Closed(object sender, EventArgs e)
  {
    this.m_command.DialogIsOpen(false);
    this.m_referenceLoc.LoseFocus();
    this.m_secondReferenceLoc.LoseFocus();
    this.m_LocationsList.LoseFocus();
    TxPhysicalRoot physicalRoot = TxApplication.ActiveDocument.PhysicalRoot;
    if (TxPhysicalRoot.op_Inequality(physicalRoot, (ITxObject) null) && TxFrame.op_Inequality(this.m_transientRefLoc, (ITxObject) null))
      this.m_transientRefLoc.Delete();
    if (TxPhysicalRoot.op_Inequality(physicalRoot, (ITxObject) null) && TxFrame.op_Inequality(this.m_secondTransientRefLoc, (ITxObject) null))
      this.m_secondTransientRefLoc.Delete();
    this.UnRegisterFromUnloadDocumentEvent();
    TxApplication.RefreshDisplay();
  }

  private void InitLocationsList()
  {
    ResourceManager resourceManager = new ResourceManager("DnProcessSimulateCommands.StringTable", ((object) this).GetType().Assembly);
    TxGridColumnData txGridColumnData = new TxGridColumnData();
    txGridColumnData.Init(resourceManager.GetString("LOCATIONS_TITLE"), (TxGridColumnType) 0);
    TxGridColumnDataCollection columnDataCollection = new TxGridColumnDataCollection();
    columnDataCollection.AddItem(txGridColumnData);
    TxGridDescription txGridDescription = new TxGridDescription();
    txGridDescription.SetData(columnDataCollection, 0);
    this.m_LocationsList.Init(txGridDescription);
  }

  private void AddLocationsToList(TxObjectList weldPoints)
  {
    foreach (ITxObject weldPoint in (Collection<ITxObject>) weldPoints)
      this.m_LocationsList.AppendObject(weldPoint);
  }

  private void m_LocationsList_Picked(object sender, TxObjGridCtrl_PickedEventArgs args)
  {
    ITxObject itxObject = args.Obj;
    ITxOperation op = itxObject as ITxOperation;
    ITxLocationOperation locationOperation = itxObject as ITxLocationOperation;
    if (op != null)
      this.AddLocationsToList(this.m_application.GetLocationsFromOperation(op));
    this.EnableOkButton();
  }

  private void m_LocationsList_RowDeleted(object sender, TxObjGridCtrl_RowDeletedEventArgs args)
  {
    this.EnableOkButton();
  }

  private void m_LocationsList_ObjectInserted(
    object sender,
    TxObjGridCtrl_ObjectInsertedEventArgs args)
  {
    this.EnableOkButton();
  }

  private void m_LocationsList_InvalidObjectTyped(
    object sender,
    TxObjGridCtrl_InvalidObjectTypedEventArgs args)
  {
    this.m_ok.Enabled = false;
  }

  private void m_LocationsList_ValidObjectTyped(
    object sender,
    TxObjGridCtrl_ValidObjectTypedEventArgs args)
  {
    this.EnableOkButton();
  }

  private void m_ok_Click(object sender, EventArgs e)
  {
    bool flag1 = this.m_application.WeldSupport && this.DoesListContainWeldLocations();
    bool flag2 = this.DoesListContainSeamLocations();
    if (flag1 & flag2 && !this.ArePerpendicularAxesEqual())
    {
      ResourceManager resourceManager = new ResourceManager("DnProcessSimulateCommands.StringTable", ((object) this).GetType().Assembly);
      string str1 = resourceManager.GetString("WELD_AND_SEAM_PERPENDICULAR_DIFFERENT");
      string str2 = resourceManager.GetString("INTERPOLATE_LOC_NAME");
      string str3 = str1.Replace("\\n", "\n");
      this.m_LocationsList.LoseFocus();
      this.m_referenceLoc.LoseFocus();
      this.m_secondReferenceLoc.LoseFocus();
      if (TxMessageBox.Show(str3, str2, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
        return;
    }
    else if (flag1 && !this.IsFixedAxisIdenticalToWeldPerpendicularAxis() || flag2 && !this.IsFixedAxisIdenticalToSeamNormalAxis())
    {
      ResourceManager resourceManager = new ResourceManager("DnProcessSimulateCommands.StringTable", ((object) this).GetType().Assembly);
      string str4 = resourceManager.GetString("LIST_CONTAINS_WELD_LOCATION_MESSAGE");
      string str5 = resourceManager.GetString("INTERPOLATE_LOC_NAME");
      string str6 = str4.Replace("\\n", "\n");
      this.m_LocationsList.LoseFocus();
      this.m_referenceLoc.LoseFocus();
      this.m_secondReferenceLoc.LoseFocus();
      if (TxMessageBox.Show(str6, str5, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
        return;
    }
    else if (this.m_firstLocation != null && this.m_secondLocation != null && ((Collection<ITxObject>) this.m_LocationsList.Objects).Contains(this.m_firstLocation) && ((Collection<ITxObject>) this.m_LocationsList.Objects).Contains(this.m_secondLocation) && ((Collection<ITxObject>) this.m_LocationsList.Objects).IndexOf(this.m_firstLocation) > ((Collection<ITxObject>) this.m_LocationsList.Objects).IndexOf(this.m_secondLocation))
    {
      ResourceManager resourceManager = new ResourceManager("DnProcessSimulateCommands.StringTable", ((object) this).GetType().Assembly);
      string str7 = resourceManager.GetString("WRONG_ORDER_FOR_REF_LOCATIONS_MESSAGE");
      string str8 = resourceManager.GetString("INTERPOLATE_LOC_NAME");
      string str9 = str7.Replace("\\n", "\n");
      this.m_LocationsList.LoseFocus();
      this.m_referenceLoc.LoseFocus();
      this.m_secondReferenceLoc.LoseFocus();
      if (TxMessageBox.Show(str9, str8, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
        return;
    }
    Cursor current = Cursor.Current;
    Cursor.Current = Cursors.WaitCursor;
    TxObjectList objects = this.m_LocationsList.Objects;
    TxTransformation refFrame = this.getRefFrame();
    TxTransformation secondRefFrame = this.getSecondRefFrame();
    TxFixedAxis fixedAxis = TxFixedAxis.NoFixedAxis;
    if (this.m_xFixedAxisButton.Checked)
      fixedAxis = TxFixedAxis.X;
    else if (this.m_yFixedAxisButton.Checked)
      fixedAxis = TxFixedAxis.Y;
    else if (this.m_zFixedAxisButton.Checked)
      fixedAxis = TxFixedAxis.Z;
    this.m_application.InterpolateLocationOrientation(objects, refFrame, secondRefFrame, fixedAxis);
    Cursor.Current = current;
    ((Form) this).Close();
  }

  private bool IsFixedAxisIdenticalToWeldPerpendicularAxis()
  {
    if (!this.m_application.WeldSupport)
      return false;
    bool perpendicularAxis = false;
    switch ((int) TxApplication.Options.Weld.Perpendicular)
    {
      case 0:
        if (this.m_xFixedAxisButton.Checked)
        {
          perpendicularAxis = true;
          break;
        }
        break;
      case 1:
        if (this.m_yFixedAxisButton.Checked)
        {
          perpendicularAxis = true;
          break;
        }
        break;
      case 2:
        if (this.m_zFixedAxisButton.Checked)
        {
          perpendicularAxis = true;
          break;
        }
        break;
    }
    return perpendicularAxis;
  }

  private bool IsFixedAxisIdenticalToSeamNormalAxis()
  {
    bool seamNormalAxis = false;
    switch ((int) TxApplication.Options.Continuous.Normal)
    {
      case 0:
      case 3:
        if (this.m_xFixedAxisButton.Checked)
        {
          seamNormalAxis = true;
          break;
        }
        break;
      case 1:
      case 4:
        if (this.m_yFixedAxisButton.Checked)
        {
          seamNormalAxis = true;
          break;
        }
        break;
      case 2:
      case 5:
        if (this.m_zFixedAxisButton.Checked)
        {
          seamNormalAxis = true;
          break;
        }
        break;
    }
    return seamNormalAxis;
  }

  private bool DoesListContainWeldLocations()
  {
    bool flag = false;
    foreach (ITxObject itxObject in (Collection<ITxObject>) this.m_LocationsList.Objects)
    {
      if (itxObject is TxWeldLocationOperation)
      {
        flag = true;
        break;
      }
    }
    return flag;
  }

  private bool DoesListContainSeamLocations()
  {
    bool flag = false;
    foreach (ITxObject itxObject in (Collection<ITxObject>) this.m_LocationsList.Objects)
    {
      if (itxObject is TxRoboticSeamLocationOperation)
      {
        flag = true;
        break;
      }
    }
    return flag;
  }

  private bool ArePerpendicularAxesEqual()
  {
    if (!this.m_application.WeldSupport)
      return false;
    bool flag = false;
    TxWeldOptions.TxPerpendicularAxis perpendicular = TxApplication.Options.Weld.Perpendicular;
    TxContinuousOptions.TxNormalAxis normal = TxApplication.Options.Continuous.Normal;
    if (perpendicular == null && (normal == null || normal == 3))
      flag = true;
    else if (perpendicular == 1 && (normal == 1 || normal == 4))
      flag = true;
    else if (perpendicular == 2 && (normal == 2 || normal == 5))
      flag = true;
    return flag;
  }

  private void m_cancel_Click(object sender, EventArgs e) => ((Form) this).Close();

  private void EnableOkButton()
  {
    if (this.m_LocationsList.IsValid() && ((Collection<ITxObject>) this.m_LocationsList.Objects).Count != 0 && this.m_refLocOK && this.m_secRefLocOK)
      this.m_ok.Enabled = true;
    else
      this.m_ok.Enabled = false;
  }

  private void m_referenceLoc_ValidFrameSet(
    object sender,
    TxFrameEditBoxCtrl_ValidFrameSetEventArgs args)
  {
    this.m_refLocOK = true;
    TxTransformation refFrame = this.getRefFrame();
    if (TxFrame.op_Equality(this.m_transientRefLoc, (ITxObject) null) && TxTransformation.op_Inequality(refFrame, (TxTransformation) null))
      this.m_transientRefLoc = TxFrameEx.CreateFrame(new TxFrameCreationDataEx("ref Frame", refFrame, true));
    else if (TxTransformation.op_Inequality(refFrame, (TxTransformation) null) && TxTransformation.op_Inequality(this.m_transientRefLoc.AbsoluteLocation, refFrame))
      this.m_transientRefLoc.AbsoluteLocation = refFrame;
    TxApplication.RefreshDisplay();
    this.EnableOkButton();
  }

  private void m_referenceLoc_InvalidFrameSet(
    object sender,
    TxFrameEditBoxCtrl_InvalidFrameSetEventArgs args)
  {
    this.m_firstLocation = (ITxObject) null;
    this.m_refLocOK = false;
    this.EnableOkButton();
  }

  private TxTransformation getRefFrame()
  {
    try
    {
      return this.m_referenceLoc.GetLocation();
    }
    catch (Exception ex)
    {
      return (TxTransformation) null;
    }
  }

  private void m_referenceLoc_Picked(object sender, TxFrameEditBoxCtrl_PickedEventArgs args)
  {
    this.m_refLocOK = true;
    this.m_firstLocation = args.Object;
    this.EnableOkButton();
    this.m_secondReferenceLoc.Focus();
  }

  private void m_secondReferenceLoc_Picked(object sender, TxFrameEditBoxCtrl_PickedEventArgs args)
  {
    this.m_secRefLocOK = true;
    this.m_secondLocation = args.Object;
    this.EnableOkButton();
    this.m_LocationsList.Focus();
  }

  private void m_secondReferenceLoc_ValidFrameSet(
    object sender,
    TxFrameEditBoxCtrl_ValidFrameSetEventArgs args)
  {
    this.m_secRefLocOK = true;
    TxTransformation secondRefFrame = this.getSecondRefFrame();
    if (TxFrame.op_Equality(this.m_secondTransientRefLoc, (ITxObject) null) && TxTransformation.op_Inequality(secondRefFrame, (TxTransformation) null))
      this.m_secondTransientRefLoc = TxFrameEx.CreateFrame(new TxFrameCreationDataEx("second ref Frame", secondRefFrame, true));
    else if (TxTransformation.op_Inequality(secondRefFrame, (TxTransformation) null) && TxTransformation.op_Inequality(this.m_secondTransientRefLoc.AbsoluteLocation, secondRefFrame))
      this.m_secondTransientRefLoc.AbsoluteLocation = secondRefFrame;
    TxApplication.RefreshDisplay();
    this.EnableOkButton();
  }

  private void m_secondReferenceLoc_InvalidFrameSet(
    object sender,
    TxFrameEditBoxCtrl_InvalidFrameSetEventArgs args)
  {
    this.m_secondLocation = (ITxObject) null;
    this.m_secRefLocOK = false;
    this.EnableOkButton();
  }

  private TxTransformation getSecondRefFrame()
  {
    try
    {
      return this.m_secondReferenceLoc.GetLocation();
    }
    catch (Exception ex)
    {
      return (TxTransformation) null;
    }
  }

  private void RegisterToUnloadDocumentEvent()
  {
    TxApplication.ActiveDocument.Unloading += new TxDocument_UnloadingEventHandler(this.OnUnloadDocument);
  }

  private void UnRegisterFromUnloadDocumentEvent()
  {
    TxApplication.ActiveDocument.Unloading -= new TxDocument_UnloadingEventHandler(this.OnUnloadDocument);
  }

  private void OnUnloadDocument(object sender, TxDocument_UnloadingEventArgs args)
  {
    ((Form) this).Close();
  }

  private void CCUiLMInterpolateLocationOrientationDlg_Load(object sender, EventArgs e)
  {
  }

  private void InitFixedAxis()
  {
    bool weldSupport = this.m_application.WeldSupport;
    if ((!weldSupport || !this.DoesListContainWeldLocations()) && this.DoesListContainSeamLocations())
    {
      switch ((int) TxApplication.Options.Continuous.Normal)
      {
        case 0:
        case 3:
          this.m_xFixedAxisButton.Checked = true;
          break;
        case 1:
        case 4:
          this.m_yFixedAxisButton.Checked = true;
          break;
        case 2:
        case 5:
          this.m_zFixedAxisButton.Checked = true;
          break;
      }
    }
    else if (weldSupport)
    {
      switch ((int) TxApplication.Options.Weld.Perpendicular)
      {
        case 0:
          this.m_xFixedAxisButton.Checked = true;
          break;
        case 1:
          this.m_yFixedAxisButton.Checked = true;
          break;
        case 2:
          this.m_zFixedAxisButton.Checked = true;
          break;
      }
    }
    else
      this.m_noneFixedAxisButton.Checked = true;
  }
}
